import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;

public abstract class AbstractBaseRun {
	
	protected String path;
	
	protected StringBuilder content;
	
	protected BaseData data;

	protected String fullName;
	
	protected String fileName;
	
	public void instance(BaseData data,String path) {
		this.data = data;
		this.path = path;
		this.fileName = data.getClassName();
		genrateContent();
		outPut();
	}
	
	/**
	 * 生成文件内容
	 * @author ye.yangyang
	 * 2018年7月5日
	 */
	abstract void genrateContent();
	
	/**
	 * 输出文件内容
	 * @author ye.yangyang
	 * 2018年7月5日
	 */
	public void outPut() {
		try {
			FileOutputStream os = new FileOutputStream(new File(path+"\\"+fileName));
			BufferedOutputStream  buff = new BufferedOutputStream(os);
			buff.write(content.toString().getBytes());
			buff.flush();
			buff.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}
